import { View, Text, Input, InputProps } from "@tarojs/components";
import "./index.less";

type IProps = {
  label: string;
  value: string;
  onChange: (string) => void;
} & InputProps;
const FormInput = ({ label, value, onChange, ...others }: IProps) => {
  return (
    <View className="form-item form-input">
      <Text className="label">{label}</Text>
      <View className="input-wrapper">
        <Input
          value={value}
          onInput={(e) => {
            onChange(e.detail.value);
          }}
          {...others}
        />
      </View>
    </View>
  );
};

export default FormInput;
